using System;
using System.Collections.Generic;
using System.IO;
using System.Media;
using System.Text;
using Microsoft.DirectX.AudioVideoPlayback;

namespace Ambience_Pack
{
    class AudioManager
    {
        private static Audio audio;
        Random rand = new Random ();

        public void LoadFilesInFolder (string folder) {
            string path = Directory.GetCurrentDirectory () + @"\NWN2Toolset\Plugins\Ambience Pack\" + folder;

            if (Directory.Exists (path)) {
                string[] filesList = Directory.GetFiles (path);
                int randomFile = rand.Next (0, filesList.Length);

                if (audio == null)
                    audio = new Audio (filesList[randomFile]);
                if (audio.Playing == true)
                    audio.Stop ();
                audio.Open (filesList[randomFile]);
                audio.Play ();
            }
        }
    }
}
